﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />
<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>

  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/ecommerce">电商管理</a></li>
          <li class="active">产品管理</li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title="产品列表"></i>&nbsp;&nbsp;<span>产品管理&nbsp;-&nbsp;产品列表</span></h2>
          </div>
          <div class="x-breadcrumb-wrapper top-margin-20" style="position: relative;">
            <ul class="nav nav-pills x-breadcrumb-nav">
              <%-- <li class="pull-left ${type eq 'ONLINE' ? 'active': ''}"><a href="${ctx.host}/products?type=online">线上</a></li> --%>
              <li class="pull-left ${type eq 'OFFLINE' ? 'active': ''}"><a href="${ctx.host}/products?type=offline">线下</a></li>
              <%-- <li class="pull-left ${type eq 'OTHERS' ? 'active': ''}"><a href="${ctx.host}/products?type=others">周边</a></li> --%>
            </ul>
          </div>
          
          <div class="x-toolbar-wrapper clearfix" style="margin-top: 15px;">
            <div class="btn-group pull-right">
              <c:choose>
                <c:when test="${type eq 'ONLINE'}">
                  <a href="${ctx.host}/products/online-product/create" data-toggle="modal" data-target="#create-online-product" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                    <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加产品
                  </a>
                  <!--<a href="${ctx.host}/products/online-year-product/create" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                    <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;添加线上年卡
                  </a>-->
                </c:when>
                <c:otherwise>
                </c:otherwise>
              </c:choose>
               
            </div>
          </div>

          <div class="x-cards row"  style="margin-top: 20px;">
            <div class="card col-xs-4" style="padding: 0px;">
              <c:forEach var="product" items="${products}" step="3" begin="0">
                <div class="col-xs-12 card">
                  <div class="panel panel-default denver-panel denver-panel-layout">
                    <div class="panel-body" style="padding: 0px;">
                      <div class="panel-img-wrapper">
                        <img alt="" src="${cloud.prod}/${product.cover}-150">
                        <div class="wrapper-operations">
                          <c:if test="${product.weight > 100}">
                            <a class="btn btn-default" href="${ctx.host}/products/${product.id}/unstick?type=${param.type}" data-target="#unstick"  data-toggle="modal"><i class="glyphicon glyphicon glyphicon glyphicon glyphicon glyphicon-share-alt"></i>排到末尾</a>
                          </c:if>
                          <a class="btn btn-default" href="${ctx.host}/products/${product.id}/stick?type=${param.type}" data-target="#stick"  data-toggle="modal" ><i class="glyphicon glyphicon glyphicon glyphicon glyphicon-arrow-up"></i>上升排序</a>
                        </div>
                      </div>
                      <div class="product-operation clearfix">
                        <p class="pull-left" style="padding: 10px; margin: 0px;color: red;">&yen;${product.currentOffer / 100}</p>
                        <p class="pull-right" style="padding: 10px; margin: 0px;">
                          <c:forEach var="tag" items="${product.tags}">
                            <label class="label label-success label-outline">${tag.value.name}</label>
                          </c:forEach>
                        </p>
                      </div>
                      <div class="product-operation clearfix" style="border-top: 1px solid #ccc;">
                        <%-- <p style="padding: 10px; margin: 0px;">${product.name}&nbsp;${product.course.individual ? product.course.hours : ''}${product.course.individual ? '课时' : ''}</p> --%>
                        <p style="padding: 10px; margin: 0px;height: 100px; word-break:break-word;">${product.summary}</p>
                      </div>
                    </div>
                    <div class="panel-footer clearfix">
                      <c:if test="${not product.status.online}">
                        <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#status" data-toggle="modal" href="${ctx.host}/products/${product.id}/status">上架</a>
                      </c:if>
                      <c:if test="${product.status.online}">
                        <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#status" data-toggle="modal" href="${ctx.host}/products/${product.id}/status">下架</a>
                      </c:if>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#display" data-toggle="modal" href="${ctx.host}/products/${product.id}/display">${product.display ? '前台隐藏' : '前台显示'}</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#buyable" data-toggle="modal" href="${ctx.host}/products/${product.id}/buyable">${product.buyable ? '关闭购买' : '开放购买'}</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" href="${ctx.host}/products/${product.id}">详情</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" href="${ctx.host}/products/${product.id}/deleted/">删除</a>
                    </div>
                  </div>
                </div>
              </c:forEach>
            </div>
            
            <div class="card col-xs-4" style="padding: 0px;">
              <c:forEach var="product" items="${products}" step="3" begin="1">
                <div class="col-xs-12 card">
                  <div class="panel panel-default denver-panel denver-panel-layout">
                    <div class="panel-body" style="padding: 0px;">
                      <div class="panel-img-wrapper">
                        <img alt="" src="${cloud.prod}/${product.cover}-150">
                        <div class="wrapper-operations">
                          <c:if test="${product.weight > 100}">
                            <a class="btn btn-default" href="${ctx.host}/products/${product.id}/unstick?type=${param.type}" data-target="#unstick"  data-toggle="modal"><i class="glyphicon glyphicon glyphicon glyphicon glyphicon glyphicon-share-alt"></i>排到末尾</a>
                          </c:if>
                          <a class="btn btn-default" href="${ctx.host}/products/${product.id}/stick?type=${param.type}" data-target="#stick"  data-toggle="modal" ><i class="glyphicon glyphicon glyphicon glyphicon glyphicon-arrow-up"></i>上升排序</a>
                        </div>
                      </div>
                      <div class="product-operation clearfix">
                        <p class="pull-left" style="padding: 10px; margin: 0px;color: red;">&yen;${product.currentOffer / 100}</p>
                        <p class="pull-right" style="padding: 10px; margin: 0px;">
                          <c:forEach var="tag" items="${product.tags}">
                            <label class="label label-success label-outline">${tag.value.name}</label>
                          </c:forEach>
                        </p>
                      </div>
                      <div class="product-operation clearfix" style="border-top: 1px solid #ccc;">
                        <%-- <p style="padding: 10px; margin: 0px;">${product.name}&nbsp;${product.course.individual ? product.course.hours : ''}${product.course.individual ? '课时' : ''}</p> --%>
                        <p style="padding: 10px; margin: 0px;height: 100px; word-break:break-word;">${product.summary}</p>
                      </div>
                    </div>
                    <div class="panel-footer clearfix">
                      <c:if test="${not product.status.online}">
                        <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#status" data-toggle="modal" href="${ctx.host}/products/${product.id}/status">上架</a>
                      </c:if>
                      <c:if test="${product.status.online}">
                        <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#status" data-toggle="modal" href="${ctx.host}/products/${product.id}/status">下架</a>
                      </c:if>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#display" data-toggle="modal" href="${ctx.host}/products/${product.id}/display">${product.display ? '前台隐藏' : '前台显示'}</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#buyable" data-toggle="modal" href="${ctx.host}/products/${product.id}/buyable">${product.buyable ? '关闭购买' : '开发购买'}</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" href="${ctx.host}/products/${product.id}">详情</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" href="${ctx.host}/products/${product.id}/deleted/">删除</a>
                    </div>
                  </div>
                </div>
              </c:forEach>
            </div>
            
            <div class="card col-xs-4" style="padding: 0px;">
              <c:forEach var="product" items="${products}" step="3" begin="2">
                <div class="col-xs-12 card">
                  <div class="panel panel-default denver-panel denver-panel-layout">
                    
                    <div class="panel-body" style="padding: 0px;">
                      <div class="panel-img-wrapper">
                        <img alt="" src="${cloud.prod}/${product.cover}-150">
                        <div class="wrapper-operations">
                          <c:if test="${product.weight > 100}">
                            <a class="btn btn-default" href="${ctx.host}/products/${product.id}/unstick?type=${param.type}" data-target="#unstick"  data-toggle="modal"><i class="glyphicon glyphicon glyphicon glyphicon glyphicon glyphicon-share-alt"></i>排到末尾</a>
                          </c:if>
                          <a class="btn btn-default" href="${ctx.host}/products/${product.id}/stick?type=${param.type}" data-target="#stick"  data-toggle="modal" ><i class="glyphicon glyphicon glyphicon glyphicon glyphicon-arrow-up"></i>上升排序</a>
                        </div>
                      </div>
                      <div class="product-operation clearfix">
                        <p class="pull-left" style="padding: 10px; margin: 0px;color: red;">&yen;${product.currentOffer / 100}</p>
                        <p class="pull-right" style="padding: 10px; margin: 0px;">
                          <c:forEach var="tag" items="${product.tags}">
                            <label class="label label-success label-outline">${tag.value.name}</label>
                          </c:forEach>
                        </p>
                      </div>
                      <div class="product-operation clearfix" style="border-top: 1px solid #ccc;">
                        <%-- <p style="padding: 10px; margin: 0px;">${product.name}&nbsp;${product.course.individual ? product.course.hours : ''}${product.course.individual ? '课时' : ''}</p> --%>
                        <p style="padding: 10px; margin: 0px;height: 100px; word-break:break-word;">${product.summary}</p>
                      </div>
                    </div>
                    <div class="panel-footer clearfix">
                      <c:if test="${not product.status.online}">
                        <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#status" data-toggle="modal" href="${ctx.host}/products/${product.id}/status">上架</a>
                      </c:if>
                      <c:if test="${product.status.online}">
                        <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#status" data-toggle="modal" href="${ctx.host}/products/${product.id}/status">下架</a>
                      </c:if>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#display" data-toggle="modal" href="${ctx.host}/products/${product.id}/display">${product.display ? '前台隐藏' : '前台显示'}</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" data-target="#buyable" data-toggle="modal" href="${ctx.host}/products/${product.id}/buyable">${product.buyable ? '关闭购买' : '开发购买'}</a>
                      <a class="btn btn-${product.available ? 'info' : 'default'}" href="${ctx.host}/products/${product.id}">详情</a>
                       <a class="btn btn-${product.available ? 'info' : 'default'}" href="${ctx.host}/products/${product.id}/deleted/">删除</a>
                    </div>
                  </div>
                </div>
              </c:forEach>
            </div>
          </div>

          <jsp:include page="/WEB-INF/include/page.jsp">
            <jsp:param name="url" value="products" />
            <jsp:param name="queryString" value="${queryString}" />
          </jsp:include>

        </div>
      </div>
    </div>
  </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/ecommerce/product/product-list.js">
    <script type="text/javascript">
      require(['page/ecommerce/product/product-list'],function(page){
          page.init();
      })
    </script>
  </d:resource>
  
</body>

</html>
